Rewrite implementation of #[alloc_error_handler]#103061
Rewrite implementation of #[alloc_error_handler]#103061bors merged 1 commit intorust-lang:masterfrom
#[alloc_error_handler]#103061Conversation
|
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki Some changes occurred in compiler/rustc_codegen_gcc cc @antoyo Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
|
r? compiler |
|
☔ The latest upstream changes (presumably #103310) made this pull request unmergeable. Please resolve the merge conflicts. |
|
r? compiler not sure if I'm the best person to review this |
|
r? @bjorn3 as you've been working on this recently |
|
r=me with merge conflicts fixed. |
|
Hi, I've seen you changed some diagnostic structs in your PR. After #103345, the way we refer to fluent messages changed. They are now in a flat namespace with the same identifier as in the fluent file. For example, |
e6a5a19 to
d2352e1
Compare
|
@bors r+ |
|
📌 Commit d2352e11fa03ff32cddaf9f7bcad8907007f2539 has been approved by It is now in the queue for this repository. |
|
☔ The latest upstream changes (presumably #103797) made this pull request unmergeable. Please resolve the merge conflicts. |
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (rust-lang#102318).
d2352e1 to
56074b5
Compare
|
@bors r=bjorn3 |
Rollup of 6 pull requests Successful merges: - rust-lang#103061 (Rewrite implementation of `#[alloc_error_handler]`) - rust-lang#103584 (Remove bounds check when array is indexed by enum) - rust-lang#103706 (Fix E0433 No Typo Suggestions) - rust-lang#103729 (interpret: fix align_of_val on packed types) - rust-lang#103759 (Use `adt_def` during type collection.) - rust-lang#103809 (Fix a typo in std::net mod doc comment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The new implementation doesn't use weak lang items and instead changes
#[alloc_error_handler]to an attribute macro just like#[global_allocator].The attribute will generate the
__rg_oomfunction which is called by the compiler-generated__rust_alloc_error_handler. If no__rg_oomfunction is defined in any crate then the compiler shim will call__rdl_oomin the alloc crate which will simply panic.This also fixes link errors with
-C link-dead-codewithdefault_alloc_error_handler:__rg_oomwas previously defined in the alloc crate and would attempt to reference theoomlang item, even if it didn't exist. This worked as long as__rg_oomwas excluded from linking since it was not called.This is a prerequisite for the stabilization of
default_alloc_error_handler(#102318).